export default [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    name: 'index',
    component: () => import('../views/IndexView.vue'),
    redirect: '/index/article',
    children: [
      {
        path: 'article',
        name: 'indexArticle',
        component: () => import('../components/index/IndexArticle.vue')
      },
      {
        path: 'source',
        name: 'indexSource',
        component: () => import('../components/index/IndexSource.vue')
      }
    ]
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/SearchView.vue'),
    redirect: '/search/article',
    children: [
      {
        path: 'article',
        name: 'searchArticle',
        component: () => import('../components/search/SearchArticle.vue')
      },
      {
        path: 'source',
        name: 'searchSource',
        component: () => import('../components/search/SearchSource.vue')
      }
    ]
  },
  {
    path: '/user',
    name: 'user',
    component: () => import('../views/UserView.vue'),
    redirect: '/user/profile/article',
    children: [
      {
        path: 'profile',
        name: 'userProfile',
        component: () => import('../components/user/UserProfile.vue'),
        redirect: '/user/profile/article',
        children: [
          {
            path: 'article',
            name: 'userProfileArticle',
            component: () => import('../components/user/profile/UserProfileArticle.vue')
          },
          {
            path: 'source',
            name: 'userProfileSource',
            component: () => import('../components/user/profile/UserProfileSource.vue')
          },
          {
            path: 'following',
            name: 'userFollowing',
            component: () => import('../components/user/profile/UserProfileFollowing.vue')
          }
        ]
      },
      {
        path: 'edit',
        name: 'userEdit',
        component: () => import('../components/user/UserEdit.vue')
      },
    ],
  },
  {
    path: '/author/:author_id',
    name: 'author',
    component: () => import('../views/AuthorView.vue'),
    redirect: to => {
      return {
        path: `/author/${to.params.author_id}/profile/article`
      }
    },
    children: [
      {
        path: 'profile',
        name: 'authorProfile',
        component: () => import('../components/author/AuthorProfile.vue'),
        redirect: to => {
          return {
            path:  `/author/${to.params.author_id}/profile/article`
          }
        },
        children: [
          {
            path: 'article',
            name: 'authorProfileArticle',
            component: () => import('../components/author/profile/AuthorArticle.vue')
          },
          {
            path: 'source',
            name: 'authorProfileSource',
            component: () => import('../components/author/profile/AuthorSource.vue')
          }
        ]
      }
    ]
  },
  {
    path: '/article/:article_id',
    name: 'article',
    component: () => import('../views/ArticleView.vue')
  },
  {
    path: '/source/:source_id',
    name: 'source',
    component: () => import('../views/SourceView.vue')
  },
]